Done solution#296
Conversation
pustoj0
left a comment
There was a problem hiding this comment.
Commit name must be about work you had done like implemented test, created calculator, WorkDone is a bad example. 👍
| <dependency> | ||
| <groupId>junit</groupId> | ||
| <artifactId>junit</artifactId> | ||
| <version>4.12</version> | ||
| <scope>test</scope> | ||
| </dependency> |
There was a problem hiding this comment.
I dob't remember adding this dependecy, and it still worked ok with org.junit.jupiter.api.Assertions
|
|
||
| public class CalculatorTest { | ||
| private static final double DELTA = 0.000001; | ||
| private static Calculator calc; |
| } | ||
|
|
||
| @Test | ||
| public void positiveAddition() { |
There was a problem hiding this comment.
Wrong test methods names, read README.md more carefully. For this task use such convention: ; For example, if we are testing the method calculate with an illegal character passed as an operation the test method name should be calculate_illegalOperation_notOk. notOk is because the test expects the calculate method to throw an exception.
| @Test | ||
| public void positiveAddition() { | ||
| expected = 8; | ||
| actual = calc.calculator(1, 7, '+'); |
There was a problem hiding this comment.
Create private static variable and use them instead of raw numbers.
| @Test | ||
| public void positiveDivision() { | ||
| expected = 2; | ||
| actual = calc.calculator(4,2, '/'); |
There was a problem hiding this comment.
calc.calculator(4, 2, '/');
missed whitespace 😈
| } | ||
|
|
||
| @Test | ||
| public void raisingPositiveToPositiveOrNegative() { |
There was a problem hiding this comment.
raisingToPower, but I doubt it critical
| @Test | ||
| public void negativeDivision() { | ||
| expected = 2; | ||
| actual = calc.calculator(-4,-2, '/'); |
| } | ||
|
|
||
| @Test | ||
| public void raisingZeroToPower() { |
There was a problem hiding this comment.
I was commented that it must be tested with positive and negative.
| package core.basesyntax; | ||
|
|
||
| public class Calculator { | ||
| public double calculator(double firstNumber, double secondNumber, char operation) { |
There was a problem hiding this comment.
| public double calculator(double firstNumber, double secondNumber, char operation) { | |
| public double calculate(double firstNumber, double secondNumber, char operation) { |
| @Test | ||
| public void calculator_raisingZeroToNegativePower_Ok() { | ||
| expected = 0; | ||
| actual = calculator.calculator(0,2,'^'); |
No description provided.